﻿using System;
using System.Collections.Generic;
using System.Text;
using Watchdog.Dal;
using Watchdog.Bll;
using Watchdog.Bll.Base;

namespace Watchdog.Bll.Factory {

    public partial class TestUnitFactory {
        public static List<TestUnit> GetAll ( ) {
            List<TestUnit> outlist = new List<TestUnit> ();
            Watchdog.Facade.TestUnit[] list = Dal.DataClient.Current.TestUnitGetAll ();
            foreach (Watchdog.Facade.TestUnit item in list)
                outlist.Add (new TestUnit (item));
            return outlist;
        }
        public static List<TestUnit> GetByZone ( string zone ) {
            List<TestUnit> outlist = new List<TestUnit> ();
            try {
                Watchdog.Facade.TestUnit[] list = Dal.DataClient.Current.TestUnitGetByZone (zone);
                foreach (Watchdog.Facade.TestUnit item in list) {
                    outlist.Add (new TestUnit (item));
                }
            } catch (System.Exception ex) {
                Log.Write (Severity.Error, null, ex);
            }
            return outlist;
        }
        public static TestUnit GetFromFacade ( Facade.TestUnit testunit ) {
            return new TestUnit (testunit);
        }
        public static Facade.TestUnit GetFromBll ( TestUnit testunit ) {
            return testunit.IntData;
        }
        public static TestUnit GetByName ( string name ) {
            return new TestUnit (DataClient.Current.TestUnitGetByName(name));
        }

    }
}
